export default class GVChartDataConvert {
    public static convert(json: any) {
        const chartData = new gv.data.ChartData();
        const data: any[] = json.items;

        data.forEach((item) => {
            const chartItem = new gv.data.ChartItem();
            const entry: any[] = item.entrys;

            entry.forEach((en) => {
                const ety = new gv.data.ChartEntry();
                ety.name = en.name;
                ety.alias = en.alias;
                ety.value = en.value;

                chartItem.addEntry(ety);
            });

            chartData.addItem(chartItem);
        });
        return chartData;
    }
}
